#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    int num;    
    while(scanf(" %d", &num) != EOF) {
        int temp, a1 = 0, a2 = 0, a2_count = 0, a3 = 0, a4_count = 0, a5 = 0;
        double a4 = 0.0;
        for(int i = 0; i < num; i++) {
            scanf(" %d", &temp);
            if (temp % 5 == 0 && temp % 2 == 0)
                a1 += temp;
            if (temp % 5 == 1) {
                a2 += pow(-1, a2_count++) * temp;
            }
            if (temp % 5 == 2)
                a3++;
            if (temp % 5 == 3) {
                a4_count++;
                a4 += temp;
            }
            if (temp % 5 == 4 && a5 < temp)
                a5 = temp;
        }
        
        if (a1 != 0)
            printf("%d ", a1);
        else
            printf("N ");
        if (a2_count != 0)
            printf("%d ", a2);
        else
            printf("N ");
        if (a3 != 0)
            printf("%d ", a3);
        else
            printf("N ");
        if (a4_count != 0)
            printf("%.1f ", a4/(double)a4_count);
        else
            printf("N ");
        if (a5 != 0)
            printf("%d\n", a5);
        else
            printf("N\n");
    }

    return 0;
}